﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../js/jquery.js" type="text/javascript"></script>
    <script src="../js/jquery.validate.js" type="text/javascript"></script>
    <script type="text/javascript">
        $().ready(function () {
            $("#thisForm").validate({
                rules: {
                    txtName: "required",
                    txtEmail: { required: true, email: true }
                },
                messages: {
                    txtName: "必填项",
                    txtEmail: { required: "必填项", email: "请输入合法的Email！" }
                },
                errorPlacement: function (error, element) {
                    //error.insertAfter(element);
                    error.appendTo($("#Msg"));
                    element.focus();
                }
            });
        });
    </script>
</head>
<body>
    <form id="thisForm" action="#">
        <div id="Msg" style="color:#ff0000;">
        </div>
         <div id="Msg1" style="color:#ff0000;">
        </div>
        user name : <input id="txtName" name="txtName" />
        Email : <input id="txtEmail" name="txtEmail" />
        <input class="submit" type="submit" value="提交" />
    </form>
</body>
</html>
